efinet: set DNS server from UEFI protocol
authorMichael Chang <mchang@suse.com>
Tue, 25 Apr 2023 15:05:20 +0000 (11:05 -0400)
committerFelix Zielcke <fzielcke@z-51.de>
Thu, 3 Jul 2025 16:35:51 +0000 (18:35 +0200)
commit75c2cd0dd5b578e1a79e2e0cccf92dd970252241
treee189b9272ca07e3747a87b4420a17069957cd519
parentfe469a17b6190fdebd4a7c7a36ed9d8c18cd5d94
efinet: set DNS server from UEFI protocol

In the URI device path node, any name rather than address can be used
for looking up the resources so that DNS service become needed to get
answer of the name's address.  Unfortunately, DNS is not defined in any
of the device path nodes so that we use the EFI_IP4_CONFIG2_PROTOCOL and
EFI_IP6_CONFIG_PROTOCOL to obtain it.

These two protcols are defined the sections of UEFI specification.

    27.5 EFI IPv4 Configuration II Protocol
    27.7 EFI IPv6 Configuration Protocol

include/grub/efi/api.h:
Add new structure and protocol UUID of EFI_IP4_CONFIG2_PROTOCOL and
EFI_IP6_CONFIG_PROTOCOL.

grub-core/net/drivers/efi/efinet.c:
Use the EFI_IP4_CONFIG2_PROTOCOL and EFI_IP6_CONFIG_PROTOCOL to obtain
the list of DNS server address for IPv4 and IPv6 respectively.  The
address of DNS servers is structured into DHCPACK packet and feed into
the same DHCP packet processing functions to ensure the network
interface is setting up the same way it used to be.

Signed-off-by: Michael Chang <mchang@suse.com>
Signed-off-by: Ken Lin <ken.lin@hpe.com>
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
Signed-off-by: Julian Andres Klode <julian.klode@canonical.com>
(rebased against 2.12)

Gbp-Pq: Topic network
Gbp-Pq: Name efinet-set-dns-from-uefi-proto.patch
grub-core/net/drivers/efi/efinet.c
include/grub/efi/api.h